const Router = require('koa-router');
const { verifyToken } = require('../controller/login.controller');
const { 
  getWorker, 
  addWorker, 
  updateWorker, 
  deleteWorker, 
  getWorkerListSortFinish,
  getWorkerListSortBenefit
} = require('../controller/worker.controller');

const workerRouter = new Router({ prefix: '/maintainers/worker' });

// 获取员工数据(附带分页)
workerRouter.get('/', verifyToken, getWorker);

// 新增员工接口
workerRouter.post('/', verifyToken, addWorker);

// 编辑员工接口
workerRouter.put('/', verifyToken, updateWorker);

// 失效员工接口
workerRouter.delete('/', verifyToken, deleteWorker);

// 获取员工按照订单完成量排序的数据列表(前10位)
workerRouter.get('/sort/finish', verifyToken, getWorkerListSortFinish);

// 获取员工按照盈利金额排序的数据列表(前10位)
workerRouter.get('/sort/benefit', verifyToken, getWorkerListSortBenefit);


module.exports = workerRouter;